function dfs (list, target, i, j) {
  if (i > j) {
    return -1
  }
  // 计算中点索引 j- i为区间长度
  let m = i + ((j - i) >> 1)
  if (list[m] < target) {
    return dfs(list, target, m + 1, j)
  } else if (list[m] > target) {
    return dfs(list, target, i, m - 1)
  } else {
    return m
  }
}
function binarySearch (list, target) {
  const n = list.length
  return dfs(list, target, 0, n - 1)
}
console.log(binarySearch(['a', 1, 2, 3, 45], 45));